export type Bean = Record<string, string | boolean | number | Date | React.ReactNode | any>;

export type BeanData<T> = Record<string, T>;
export interface PageBean {
  /* 当前页  */
  current: number;
  /* 每一项记录数  */
  pageSize: number;
  /* 总页数  */
  totalPageSize?: number;
  /* 记录总数  */
  total?: number;
}

export interface BackPageBean<T = Bean> {
  /* 当前页  */
  pageNum: number;
  /* 每一项记录数  */
  pageSize: number;
  /* 总页数  */
  totalPage: number;
  /* 记录总数  */
  totalCount: number;
  [K: string]: T | Bean | number;
}

export interface ResultBean<T = Bean> {
  success: boolean;
  code: number;
  message: string;
  data: T;
  pageInfo?: PageBean;
}

export type ResultBeanAsObject = ResultBean<Bean>;

export type ResultBeanAsNull = ResultBean<null>;

export type ResultBeanAsAny = ResultBean<any>;
export type ResultBackPageBean<T = Bean> = ResultBean<BackPageBean<T>>;

// export interface BaseServices<T> {
//   queryPageList: (params: Bean) => Promise<ResultBackPageBean>;
//   queryList: (params: Bean) => Promise<ResultBean<T>>;
//   queryDetail: (params: Bean) => Promise<ResultBean<T>>;
//   add: (params: Bean) => Promise<ResultBean<T>>;
//   modify: (params: Bean) => Promise<ResultBean<T>>;
//   remove: (params: Bean) => Promise<ResultBean<T>>;
//   [key: string]: (params: Bean) => Promise<ResultBean<T>>;
// }


export type BaseService<TData = Bean, TParams extends any[] = Bean[]> = (
  ...args: TParams
) => Promise<TData>;
// export type BaseService<T = any> = (params: Bean) => Promise<T>;

export interface BaseServices {
  // queryListPage: BaseService<ResultBean<TData[]>,Bean[]>;
  // queryList: BaseService<ResultBean<TData[]>>;
  // queryDetail: BaseService<ResultBean<TData>>;
  // add: BaseService<ResultBean<TData>>;
  // modify: BaseService<ResultBean<TData>>;
  // remove: BaseService<ResultBean<TData>>;
  [key: string]: BaseService;
}
